SparkPlug B - Unified Namespace
The SparkPlug B - Unified Namespace, is a deviceWISE Extension that implements the open source software specification that provides MQTT Clients with the framework to seamlessly integrate data from their applications, sensors, devices and gateways within the MQTT Infrastructure.
The SparkPlug B Extension is capable of leveraging deviceWISE MQTT connections, promoting the possibility of defining multiple EON nodes and, for each, specify a variety of device variables mapped to SparkPlug metrics. These metrics are assigned to a corresponding Sparkplug device within the EON node and do not appear with the EON itself.
The SparkPlug B functionality is part of the deviceWISE MQTT package.
Currently Templates and Edge Node Commands are not supported.
Prerequisites
-
All deviceWISE Platforms:
-
A MQTT broker connected to the network such as the demo broker available on the internet at broker.hivemq.com port 1883;
-
The Workbench has been updated with a new administration panel for Sparkplug, the minimum version is 22.03.
Using SparkPlug
At least one MQTT broker connection is required before SparkPlug can be configured. Once the device has been added and configured, the Sparkplug Edge Node can be created from the Administration Panel.
To do this, locate the Sparkplug B tab at the Administration Panel of the node, and click Add.
A new sub-tab will appear with the parameter fields.
Parameter |
Description |
---|---|
Group Name | The Group Name is used to group one or more edge nodes together. |
id |
The node id is the name that uniquely identifies the edge node. |
QOS Setting | The QOS setting defines the frequency of variable updates. The primary and secondary broker fields identify |
Primary Broker | The primary broker field identify which MQTT Connection will be used as the primary. The Primary Broker is mandatory. |
Failover Broker | The Failover Broker is optional, it is used in case of failure of the first. |
Aggregation Time |
Is the time in milliseconds used to collect information before publishing. |
Removing, Editing, Starting and Stopping an Edge Node
Through the Sparkplug B tab, apart from Adding an Edge Node definition, it is possible to Remove, Edit, Start or Stop an Edge Node, selecting it at the list, and then clicking at the button with the desired action.
Edge Node Lifecycle
An Edge Node has 3 states:
-
Unknown;
-
Stopped;
-
Started.
In the Started state the driver will attempt to connect to the primary server and send an edge node birth message followed by device birth messages for each device.
Within the edge node birth message is a list of metrics containing values for each of the variables.
When a value changes it is placed onto a queue and a DDATA message will be send with all of the values that have changed. The DDATA message is sent after the aggregation time has expired.
When an Edge Node is stopped a death message will be sent.
When a device is Stopped or Started while the edge node is running, a corresponding device birth or death message will be sent.
If the connection to the primary server fails then an attempt to connect to the failover server will be made.
To remove a node, it is necessary to have previously stopped it.
Error Codes
Error Code |
Name |
Description |
---|---|---|
-33700 | Out of memory. | Unable to allocate memory at runtime. |
-33701 | Protobuf encode failed. | Enable to encode protobuf message. |
-33702 | Edge node Internal error. | Sparkplug internal error. |
-33404 | Too many edge nodes. | More than 64 edge nodes were defined. |
-33705 | Edge node create failed. | Unable to create an edge node. |
-33706 | Edge node insert failed. | Unable to insert an ede node. |
-33707 | Edge node already exists. | The edge node already exists. |
-33708 | Edge node not found. | The edge node was not found. |
-33709 | Edge node service failed. | The edge node service failed. |
-33710 | Edge node already running. | The edge node is already running. |
-33711 | Edge node not running. | The edge node is not running. |
-33712 | Duplicate MQTT connection. | A duplicate MQTT client connection was selected. |
-33713 | MQTT Client not running. | The MQTT client is not running. |
-33714 | Edge node connector not running. | The edge node connector is not running. |
-33715 | Device not running. | The device is not running. |
-33716 | Device already running. | The device is already running. |
-33717 | Metrics not initialized. | The metrics are not initialized. |
-33718 | Edge node service in progress. | An edge node service is already in progress. |